package d2_xml;

import java.io.PrintStream;

public class Demo4JTest03 {
    public static void main(String[] args) throws Exception {
        //目标: 写一个xml数据到文件中去
        StringBuilder sb = new StringBuilder();

        //进行拼接即可
        sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
        sb.append("<users>\r\n");
        sb.append("<name>").append("陈平安").append("</name>\r\n");
        sb.append("<sex>").append('男').append("</sex>\r\n");
        sb.append("<email>").append("19865346769@163.com").append("</email>\r\n");
        sb.append("</users>\r\n");


        //然后创建一个打印流
        PrintStream printStream = new PrintStream("javapromax\\day11-speical-file-log-code\\src\\user02.xml");

        //调用方法直接进行打印
        printStream.println(sb);
        //关闭流
        printStream.close();
    }
}
